Default M365 Tenant Onboarding Script
The default M365 Onboarding script is shown below. This script is hard-coded and is not included in the SQL database.
Copy
# Begin of Microsoft onboarding script
# Add PSTN Usage record Unrestricted if not exists
if(Get-CsOnlinePstnUsage | Where-Object Usage -NotContains "Unrestricted")
{
Set-CsOnlinePstnUsage -Identity Global -Usage @{Add="Unrestricted"};
}
# Add Online Voice Route Unrestricted if not exists, else add additional PSTN Gateway to the OnlinePstnGatewayList if there is a new PSTN Gateway
if(Get-CsOnlineVoiceRoute | Where-Object {$_.Identity -eq "Unrestricted"})
{
Write-host "The CsOnlineVoiceRoute named Unrestricted already exists."
if(Get-CsOnlineVoiceRoute -Identity "Unrestricted" | Where-Object {$_.OnlinePstnGatewayList -NotContains "{{SBC.OnlinePstnGateway}}"})
{
Write-host "A new PSTN Gateway is added to the the OnlinePstnGatewayList."
Set-CsOnlineVoiceRoute -Identity "Unrestricted" -OnlinePstnGatewayList @{add="{{SBC.OnlinePstnGateway}}"}
}
}else {
Write-host "The CsOnlineVoiceRoute named Unrestricted does not exist, creating one."
New-CsOnlineVoiceRoute -Identity "Unrestricted" -NumberPattern ".*" -OnlinePstnGatewayList @{add="{{SBC.OnlinePstnGateway}}"} -Priority 1 -OnlinePstnUsages @{add="Unrestricted"};
}
# Add Voice Routing Policy Unrestricted if not exists
if(Get-CsOnlineVoiceRoutingPolicy | Where-Object {$_.Identity -like "Tag:Unrestricted"})
{
continue
}else {
New-CsOnlineVoiceRoutingPolicy -Identity "Unrestricted" -OnlinePstnUsages "Unrestricted";
}
# End of M365 onboarding script;
Custom variables can be applied to this script in a similar manner to the SBC scripts.